import { RouteRecordRaw } from "vue-router";
import { HOME_URL } from "@/config";

/**
 * staticRouter (静态路由)
 */
export const staticRouter: RouteRecordRaw[] = [
  {
    path: "/",
    redirect: HOME_URL
  },
  {
    path: HOME_URL,
    name: "home",
    component: () => import("@/views/demo/index.vue"),
    meta: {
      title: "用户",
      buttons: [
        {
          //你懂的，这要放在菜单请求接口里面
          menuName: "新增",
          clickEvent: "createPopup",
          url: null,
          pageSize: "50% ,80%",
          style: "primary",
          orderNum: 1
        },
        {
          menuName: "修改",
          clickEvent: "editPopup",
          url: "row-data",
          //代表编辑数据时不走接口，采用表格行数据
          pageSize: "50% ,80%",
          style: "primary",
          orderNum: 2
        },
        {
          menuName: "删除",
          clickEvent: "deleteData",
          url: "/geeker/user/delete",
          pageSize: null,
          style: "warning",
          orderNum: 3
        }
      ]
    }
  }
  // {
  //   path: LOGIN_URL,
  //   name: "login",
  //   component: () => import("@/views/login/index.vue"),
  //   meta: {
  //     title: "登录"
  //   }
  // },
  // {
  //   path: "/layout",
  //   name: "layout",
  //   component: () => import("@/layouts/index.vue"),
  //   // component: () => import("@/layouts/indexAsync.vue"),
  //   redirect: HOME_URL,
  //   children: []
  // }
];

/**
 * errorRouter (错误页面路由)
 */
export const errorRouter = [
  {
    path: "/403",
    name: "403",
    component: () => import("@/components/ErrorMessage/403.vue"),
    meta: {
      title: "403页面"
    }
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/components/ErrorMessage/404.vue"),
    meta: {
      title: "404页面"
    }
  },
  {
    path: "/500",
    name: "500",
    component: () => import("@/components/ErrorMessage/500.vue"),
    meta: {
      title: "500页面"
    }
  },
  // Resolve refresh page, route warnings
  {
    path: "/:pathMatch(.*)*",
    component: () => import("@/components/ErrorMessage/404.vue")
  }
];
